//请求文本内容
const xhr = new XMLHttpRequest();

self.onmessage = (e) => {
    xhr.open('get', '/get_' + e.data, true);
    xhr.send();
    xhr.onreadystatechange = () => {
        if (xhr.readyState === 4 && xhr.status === 200) {
            if (xhr.responseText === 'no') {
                return;
            }
            let objDate = JSON.parse(xhr.responseText);
            let temp = '';
            for (let i = 0; i < objDate.infoArr.length; i++) {
                if (objDate.infoArr[i].id !== '') {
                    temp += `<article>
                    <div>
                        <h3>${objDate.infoArr[i].title}</h3>
                        <p class="id" data-id="${objDate.infoArr[i].id}">Id：${objDate.infoArr[i].id}</p>
                        <p class="content">${objDate.infoArr[i].context}</p>
                        <p class="a_href">url：${objDate.infoArr[i].aHref}</p>
                        <p class="update">${objDate.infoArr[i].update}</p>
                        <button class="del">删 除</button>
                    </div>
                    <div>
                        <img src="${objDate.infoArr[i].imgUrlBase64}" alt="">
                    </div>
                   </article>`
                }
            }
            self.postMessage(temp);
        }
    }
}